package androidchat.com.view;

import java.util.List;



import com.androidchat.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class RegisterAdapter extends BaseAdapter {
   
	private Context context;
	private List<String> list;
	LayoutInflater inflater;
	public RegisterAdapter(Context context,List<String> list) {
		// TODO Auto-generated constructor stub
		this.list=list;
		this.context=context;
		inflater=LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return list.get(arg0);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		convertView=inflater.inflate(R.layout.spinner_item,null);
		ImageView avater=(ImageView) convertView.findViewById(R.id.image);
		String im=list.get(position);
		int i=context.getResources().getIdentifier(im, "drawable",context.getPackageName());
		avater.setImageResource(i);
		return convertView;
	}

}
